return NULL;
}
return (void *) (offset + (char *)addr);
+ #else
+ return NULL;
+ #endif
}
- /*
- * 'vfree' is basically inlined here. This is because we use a different
- * function to zap the associated page range.
- */
void iounmap(void *addr)
{
- struct vm_struct **p, *tmp;
-
- addr = (void *)((unsigned long)addr & PAGE_MASK);
-
- if (addr == NULL)
- return;
-
- write_lock(&vmlist_lock);
-
- for (p = &vmlist ; (tmp = *p) ; p = &tmp->next) {
- if (tmp->addr == addr) {
- *p = tmp->next;
- direct_zap_page_range(&init_mm,
- VMALLOC_VMADDR(tmp->addr),
- tmp->size);
- write_unlock(&vmlist_lock);
- kfree(tmp);
- return;
- }
- }
-
- write_unlock(&vmlist_lock);
- printk(KERN_ERR "Trying to iounmap() nonexistent vm area (%p)\n", addr);
+ vfree((void *)((unsigned long)addr & PAGE_MASK));
}
+void __init *bt_ioremap(unsigned long machine_addr, unsigned long size)
+{
+ unsigned long offset, last_addr;
+ unsigned int nrpages;
+ enum fixed_addresses idx;
+
+ /* Don't allow wraparound or zero size */
+ last_addr = machine_addr + size - 1;
+ if (!size || last_addr < machine_addr)
+ return NULL;
+
+ /*
+ * Mappings have to be page-aligned
+ */
+ offset = machine_addr & ~PAGE_MASK;
+ machine_addr &= PAGE_MASK;
+ size = PAGE_ALIGN(last_addr) - machine_addr;
+
+ /*
+ * Mappings have to fit in the FIX_BTMAP area.
+ */
+ nrpages = size >> PAGE_SHIFT;
+ if (nrpages > NR_FIX_BTMAPS)
+ return NULL;
+
+ /*
+ * Ok, go for it..
+ */
+ idx = FIX_BTMAP_BEGIN;
+ while (nrpages > 0) {
+ set_fixmap(idx, machine_addr);
+
+ //unsigned long address = __fix_to_virt(idx);
+
+
+
+//direct_set_pte(address, direct_mk_pte_phys(machine_addr, PAGE_KERNEL_NOCACHE));
+
+ machine_addr += PAGE_SIZE;
+ --idx;
+ --nrpages;
+ }
+
+flush_tlb_all();
+
+ return (void*) (offset + fix_to_virt(FIX_BTMAP_BEGIN));
+}
+
#if 0 /* We don't support these functions. They shouldn't be required. */
void __init *bt_ioremap(unsigned long machine_addr, unsigned long size) {}